﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Nyamr;

namespace WordCount
{
    public class WordMapper : BaseMapper
    {
        public override void Map(string key, byte[] value, IEmitter emitter)
        {
            var text = Encoding.UTF8.GetString(value);

            foreach (var word in text.Split())
            {
                emitter.Emit(word, Encoding.UTF8.GetBytes("1"));
            }
        }

        public override void Dispose() { }
    }
}
